package com.lenovo.lcdm.type.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lenovo.lcdm.type.entity.TypeAttributeDataTypeSeq;
import com.lenovo.lcdm.type.mapper.TypeAttributeDatatypeSeqMapper;
import com.lenovo.lcdm.type.service.TypeAttributeDataTypeSeqService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
* @author xujing30
* @description Service实现
* @createDate 2024-01-03
*/
@Service
public class TypeAttributeDataTypeSeqServiceImpl extends ServiceImpl<TypeAttributeDatatypeSeqMapper, TypeAttributeDataTypeSeq>
    implements TypeAttributeDataTypeSeqService {

    @Override
    public TypeAttributeDataTypeSeq getAttributeDataTypeSeq(Long typeDefinitionId, Long dataTypeId) {
        LambdaQueryWrapper<TypeAttributeDataTypeSeq> attributeDataTypeSeqQw = new LambdaQueryWrapper<>();
        attributeDataTypeSeqQw.eq(TypeAttributeDataTypeSeq::getDataTypeId, dataTypeId).eq(TypeAttributeDataTypeSeq::getTypeDefinitionId, typeDefinitionId);
        List<TypeAttributeDataTypeSeq> seqs = this.list(attributeDataTypeSeqQw);
        return CollectionUtils.isEmpty(seqs) ? null : seqs.get(0);
    }
}




